home *** CD-ROM | disk | FTP | other *** search
/ 64'er 1991 June / 64er_Magazin_91-06_1991_Markt__Technik_de.d64 / regula falsi (.txt) < prev    next >
Commodore BASIC  |  2022-10-26  |  742b  |  36 lines

  1. 10 print"[147]":rem regula falsi
  2. 20 print" berechnung von nullstellen"
  3. 25 print" fuer ganze rat. funktionen"
  4. 30 print"   nach der regula falsi"
  5. 40 print" **************************"
  6. 50 print:input" grad der funktion:";g:print
  7. 70 dimk(g)
  8. 80 fori=gto0step-1
  9. 85 print" koeffizient fuer x^"i;:inputk(i)
  10. 90 nexti
  11. 94 :
  12. 95 goto150
  13. 100 rem   up  horner-schema
  14. 110 y=k(g)
  15. 120 fori=gto1step-1
  16. 130 y=y*x+k(i-1)
  17. 140 nexti
  18. 145 return
  19. 150 :
  20. 160 print:input" naeherungswert x0 ";x0
  21. 170 input" naeherungswert x1 ";x1
  22. 195 :
  23. 200 x=x0:gosub100:y0=y
  24. 220 x=x1:gosub100:y1=y
  25. 225 :
  26. 230 ifsgn(y0)=sgn(y1)thenprint" sekante schneidet x-achse nicht":goto160
  27. 235 :
  28. 240 x2=x0-y0*((x1-x0)/(y1-y0))
  29. 250 x=x2:gosub100:y2=y
  30. 270 ifabs(y2)<1e-6then290
  31. 275 ifsgn(y2)=sgn(y1)thenx1=x2:goto200
  32. 280 ifsgn(y2)=sgn(y0)thenx0=x2:goto200
  33. 290 print:print" nullstelle bei x="x2
  34. 300 print:print" y-wert an der stelle="y2
  35. 310 goto160
  36.